package com.gxgeek.javabasic.generic;


import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author gaoxing
 * @create 2018-06-09 下午3:05
 */
public class Generic {


    @SuppressWarnings("all")
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

        List<?> list = new ArrayList<>();

        Object p = "s";
//        Integer s = 1;
//        list.add(p);
        list.getClass().getMethod("add", Object.class).invoke(list, p);
//        list.getClass().getMethod("add", Object.class).invoke(list, s);
        System.out.println(list);
        System.out.println("run");
    }
    private void a(){
        ArrayList<String> arrayList1=new ArrayList<String>();
        arrayList1.add("abc");
        ArrayList<Integer> arrayList2=new ArrayList<Integer>();
        arrayList2.add(123);
        System.out.println(arrayList1.getClass()==arrayList2.getClass());

    }
}
